<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form action="https://baidu.com">
    <input type="submit" value="提交"/>
</form>
<!--给元素添加相同事件 阻止默认行为-通过调用事件的preventDefault方法-->
<script>
    const btn = document.querySelector('form');
    console.log(btn)
    btn.addEventListener('submit',function (ev){
        ev.preventDefault()
    })
</script>
</body>
</html>